package com.hengfoxwolf.jetpackdemo.ui.home

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

class HomeViewModel : ViewModel() {

    private val _text = MutableLiveData<String>().apply {
        value = "This is home Fragment"
    }
    val text: LiveData<String> = _text

    val sharedFlow = MutableSharedFlow<Int>()

    val stateFlow = MutableStateFlow(0)

    fun updateData() {
        viewModelScope.launch {
            withContext(Dispatchers.IO) {
                
            }
        }
    }

    override fun onCleared() {
        super.onCleared()
    }
}